package com.coda.mapper;

import com.coda.entity.Purchase;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface PurchaseMapper {
    /**
     * 添加采购单
     * @param purchase
     */
    void addPurchase(Purchase purchase);

    /**
     * 分页查询采购单
     * @param purchase
     * @return
     */
    Page<Purchase> getPgae(Purchase purchase);

    /**
     * 根据id删除采购单
     * @param id
     */
    @Delete("delete from buy_list where buy_id = #{id}")
    void deleteById(Long id);

    /**
     * 根据id修改采购单
     * @param purchase
     */
    void update(Purchase purchase);

    /**
     * 根据id设置入库状态
     * @param buyId
     */
    @Update("update buy_list set is_in = 1 where buy_id = #{buyId}")
    void updateInStoreById(Integer buyId);
}
